import request from '@/router/axios'
import store from '@/store'
import {
  getLineName,
  getStationName,
} from "../../commonCheck";
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  menu:false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  selection: true,
  searchLabelWidth:100,
  reserveSelection:false,
  addBtn: false,
  column: [
  // {
  //   fixed: true,
  //   label: '主键',
  //   prop: 'id',
  //   span: 24,
  //   hide: true
  // }, 
  // {
  //   hide: false,
  //   label: '线路',
  //   prop: 'lineCode',
  //   type: 'select',
  //   search: true,
  //   filterable : true,
  //   cascaderItem: ["stationCode","conductorPersonId"],
  //   props: {
  //     label: 'name',
  //     value: 'code'
  //   },
  //   dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
  //   display: true // 动态显隐控制不能删除
  // }, {
  //   hide: false,
  //   label: '站点',
  //   prop: 'stationCode',
  //   type: 'select',
  //   search: true,
  //   filterable : true,
  //   dicFlag: false,
  //   props: {
  //     label: 'name',
  //     value: 'code'
  //   },
  //   dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
  //   display: true// 动态显隐控制不能删除
  // },
  {
    width: 100,
    label: "线路", prop: "lineCode", search: true, searchslot: true, formatter: function (row, value, label, column) {
      return getLineName(value);
    }
  },

    {
      width: 180,
      label: "站点",
      prop: "stationCode",
      search: true,
      searchslot: true,
      formatter: function (row, value, label, column) {
        return getStationName(row.lineCode, value);
      }
    },
    {
      width: 120,
      label: "售票员",
      prop: "conductorPersonName",
      type: 'select',
      search: true,
      searchslot: true,
      formatter: function (row, value, label, column) {
        return value;
      },
      hide:true
    },
  {
    label: '收入日期',
    prop: 'checkTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 100,
    type: 'date',
    hide: false,
    search: true
  },{
    label: '结算开始日期',
    prop: 'incomeSettleBeginTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 100,
    type: 'date',
    hide: false,
    search: true
  },{
    label: '结算结束日期',
    prop: 'incomeSettleEndTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 100,
    type: 'date',
    hide: false,
    search: true
  },{
    label: '短款金额',
    prop: 'shortAmount',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    },
    search: false,
    hide: false,
    type:'input',
  }, 
  // {
  //   label: '售票员',
  //   prop: 'conductorPersonId',
  //   search: true,
  //   searchslot : true,
  //   hide: true,
  // }, 
  {
    width: 130,
    label: '售票员',
    prop: 'conductorPerson',
    search: false,
    hide: false,
  }, {
    width: 130,
    label: '售票员工号',
    prop: 'conductorPersonCode',
    search: false,
    hide: false,
  }, {
    hide: false,
    label: '通知时间',
    prop: 'noticeTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  }, {
    hide: false,
    label: '通知状态',
    prop: 'isNotice',
    formatter:function(row, value , label, column){
      return value == 1?'已通知':'未通知';
    },
    dicData: [{
      label: '未通知',
      value: 0
    }, {
      label: '已通知',
      value: 1
    }],
    type: 'select',
    search: true
  }, {
    label: '通知人',
    prop: 'noticeName',
    search: false,
    hide: false,
  },{
    hide: false,
    label: '补款状态',
    prop: 'isSupPayment',
    formatter:function(row, value , label, column){
      return value == 0?'未补款':'已补款';
    },
    type: 'select',
    dicData: [{
      label: '未补款',
      value: 0
    }, {
      label: '已补款',
      value: 1
    }],
    search: true
  }, {
    hide: false,
    label: '补款日期',
    prop: 'supPaymentTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  },{
    hide: false,
    label: '入账时间',
    prop: 'accountTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  },{
    hide: false,
    label: '是否期限内补款',
    width: 140,
    searchLabelWidth:120,
    formatter:function(row, value , label, column){
      return value == 1?'是':(value == 0?'否':'');
    },
    prop: 'isLimitSuppay',
    type: 'select',
    dicData: [{
      label: '否',
      value: 0
    }, {
      label: '是',
      value: 1
    }],
    search: true
  }, {
    width: 120,
    hide: false,
    label: '补款期限天数',
    prop: 'supPaymentLimit',
    search: false
  }, {
    hide: false,
    label: '补款期限时间',
    prop: 'supPaymentTimelimit',
    format: 'yyyy-MM-dd',
    width: 120,
    valueFormat: 'yyyy-MM-dd',
    type:'date',
    search: false
  }]
}


export const tableOptionLimit = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  menu:false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  selection: false,
  reserveSelection:false,
  addBtn: false,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    hide: false,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    search: false,
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
    display: true // 动态显隐控制不能删除
  }, {
    hide: false,
    label: '站点',
    prop: 'stationCode',
    type: 'select',
    search: false,
    dicFlag: false,
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
    display: true// 动态显隐控制不能删除
  },{
    label: '收入日期',
    prop: 'checkTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type: 'date',
    hide: false,
    search: false
  },{
    hide: false,
    label: '入账时间',
    prop: 'accountTime',
    format: 'yyyy-MM-dd',
    width: 90,
    valueFormat: 'yyyy-MM-dd',
    slot:true,
    formslot:true,
    cell: true,
    type:'date',
    search: false
  },{
    label: '短款金额',
    prop: 'shortAmount',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    },
    search: false,
    hide: false,
    type:'input',
  }, {
    label: '售票员',
    prop: 'conductorPerson',
    search: false,
    hide: false,
  }, {
    width: 100,
    label: '售票员工号',
    prop: 'conductorPersonCode',
    search: false,
    hide: false,
  }, {
    hide: false,
    label: '通知状态',
    prop: 'isNotice',
    formatter:function(row, value , label, column){
      return value == 1?'已通知':'未通知';
    },
    type: 'select',
    search: false
  },{
    hide: false,
    label: '补款状态',
    prop: 'isSupPayment',
    formatter:function(row, value , label, column){
      return value == 0?'未补款':'已补款';
    },
    type: 'select',
    search: false
  }, {
    hide: false,
    label: '补款日期',
    prop: 'supPaymentTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  }, {
    hide: false,
    label: '补款期限天数',
    prop: 'supPaymentLimit',
    width:120,
    slot:true,
    formslot:true,
    cell: true,
    search: false
  }]
}
export function getSwAuConductorShort(param) {
  return request({
    url: '/check/check/getSwAuConductorShort',
    method: 'post',
    params: param
  })
}
export function getSwAuConductorShortLimit(param) {
  return request({
    url: '/check/check/getSwAuConductorShortLimit',
    method: 'post',
    params: param
  })
}
export function updateSwAuConductorShortLimit(param) {
  return request({
    url: '/check/check/updateSwAuConductorShortLimit',
    method: 'post',
    params: param
  })
}
export function updateSwAuConductorShort(query) {
  return request({
    url: '/check/check/updateSwAuConductorShort',
    method: 'post',
    //params: param
    data: query
  })
}
export function getSysUserToLine(param) {
  return request({
    url: '/check/check/getSysUserToLine',
    method: 'post',
    params: param
  })
}

